package pe.com.rimac.portal.tag.url;

import javax.servlet.jsp.JspException;

import pe.com.rimac.portal.tag.PortletBaseTag;

public class UrlParamTag extends PortletBaseTag 
{
    private String name;
    private String value;
    
    public int doStartTag() throws JspException
    {
        UrlTag tag = (UrlTag)findAncestorWithClass(this, UrlTag.class);
        if (tag == null)
        {
            throw new JspException("UrlParamTag must be nested inside a UrlTag");
        }
        tag.addParam(name, value);
        return SKIP_BODY;
    }
    
    public int doEndTag()
    {
       return EVAL_PAGE;
    }
    
    public void setName(String name)
    {
        this.name = name;
    }
    
    public void setValue(String value)
    {
        this.value = value;
    }
}